package com.salesmanager.core.business.reference.init.service;

import com.salesmanager.core.business.generic.exception.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Date;

@Service("initializationDatabase")
public class InitializationDatabaseImpl implements InitializationDatabase {

    private static final Logger LOGGER = LoggerFactory.getLogger(InitializationDatabaseImpl.class);



    private String name;

    public boolean isEmpty() {
        return false;
    }

    @Transactional
    public void populate(String contextName) throws ServiceException {
        this.name = contextName;
        createModules();
        createMerchant();
    }


    private void createMerchant() throws ServiceException {
        LOGGER.info(String.format("%s : Creating merchant ", name));

        Date date = new Date(System.currentTimeMillis());

        //create a merchant

    }

    private void createModules() throws ServiceException {




    }


}
